<table class="product-items">
    <tbody>
    <tr class="odd xtable-data-row">
        <td align="center" class="product-checkbox-column" width="10"><input value="<?php echo $data->id;?>" class="select-on-check" type="checkbox" name="item" id="item"></td>
<!--        <td align="center" width="150" style="text-align: center">--><?php //echo $data->id;?><!----><?php //echo CHtml::hiddenField("Id[Subproduct][]",$data->id);?><!--</td>-->
        <?php echo CHtml::hiddenField("Id[Subproduct][]",$data->id);?>
        <td align="center" width="150" style="text-align: center"><?php echo $data->sku;?></td>
        <?php
        $model = SubProduct::model()->findByPk($data->id);
        $attrs = $this->getAttributesSubproduct($model,$productId);
        asort($attrs);
        foreach ($attrs as $key => $attr){
            if ($attr['type'] == AttributeGroup::TYPE_MULTIPLE)
                echo '<td align="center" width="150" style="text-align: center">'.CHtml::dropDownList('attribute_' . $key .'['.$data->id.']', $this->getSelectedAttributesSubproduct($model, $key), $attr['data'], array('multiple' => 'multiple',"style"=>"width:150px;")).'</td>';
            else
                echo '<td align="center" width="150" style="text-align: center">'.CHtml::dropDownList('attribute_' . $key.'['.$data->id.']', $this->getSelectedAttributesSubproduct($model, $key), $attr['data'], array('prompt' => '---Select---',"style"=>"width:150px;")).'</td>';
        }
        ?>
        <td align="center" width="150" style="text-align: center"><?php echo CHtml::TextField("StockTotal[".$data->id."]",$data->stock_total,array("style"=>"width:80px;"));?></td>
        <td align="center" width="150" style="text-align: center"><?php echo $data->stock_reserved;?></td>
        <td align="center" width="100" style="text-align: center"><?php echo CHtml::TextField("Price[".$data->id."]",$data->getNormalPriceColumnContent(),array("style"=>"width:50px;"));?></td>
        <td align="center" width="100" style="text-align: center"><?php echo CHtml::TextField("SalePrice[".$data->id."]",$data->getSalePriceColumnContent(),array("style"=>"width:50px;"));?></td>
        <td align="center" width="100" style="text-align: center"><?php echo CHtml::dropDownList('ChargeShippingOption['.$data->id.']', $data->charge_shipping_option, array('free' => 'Free', 'fixed' => 'Fixed','surcharge' => 'Surcharge'),array('prompt'=>'---',"style"=>"width:100px;"));?></td>
        <td align="center" width="100" style="text-align: center"><?php echo CHtml::TextField("ShipCost[".$data->id."]",$data->shipping_cost,array("style"=>"width:50px;"));?></td>
        <td align="center" width="100" class="status-column minimal-hide" style="text-align: center"><?php echo CHtml::link($data->status ? "<i class='icon-ok'></i>" : "<i class='icon-ban-circle'></i>", array("/Xpress/service/ajax", "SID"=>"Shop.SubProduct.changeStatus", "ids[]"=>$data->id, "value"=>$data->status ? 0 : 1), array("class"=>($data->status ? "active" : ""))); ?></td>
        <td align="center" width="50" class="product-actions-column actions-column" style="text-align: center">
            <?php echo CHtml::link('<i class="icon-pencil"></i>', url('/Shop/admin/subProduct/update',array('id'=>$data->id,'product_id'=>$data->product_id)), array('class'=>'xtarget-detail', 'title' => 'Update'));?>
            <?php echo CHtml::link('<i class="icon-eye-open"></i>', Yii::app()->controller->previewUrl($data), array('class' => 'preview', 'title' => 'Preview', 'target' => '_blank'));?>
            <?php echo CHtml::link('<i class="icon-trash"></i>', url('/Shop/admin/subProduct/delete',array('id'=>$data->id)), array('class'=>'delete', 'title' => 'Delete'));?>
            <?php echo CHtml::link('<i class="icon-tag"></i>', url('/Shop/admin/product/setDefaultSubproduct',array('subId'=>$data->id,'productId'=>$productId)), array('class'=>'set-default-subproduct', 'title' => 'Set Default'));?>
        </td>
    </tr>
    </tbody>
</table>
